import Vue from 'vue'
import Router from 'vue-router'

const main = r => require.ensure([], () => r(require('../components/main/index')), 'index')
const login = r => require.ensure([], () => r(require('../components/login/index')), 'index')

const my = r => require.ensure([], () => r(require('../components/my/index')), 'index')
const shop = r => require.ensure([], () => r(require('../components/shop/index')), 'index')


Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'main',
      component: main,
      children: [
        {
          path: '/my',
          name: 'my',
          component: my
        },
        {
          path: '/shop',
          name: 'shop',
          component: shop
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: login
    }
  ]
})

